package com.neusoft.elmboot.constants;

import java.math.BigDecimal;

import javax.annotation.PostConstruct;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.neusoft.elmboot.mapper.EditablePropertiesMapper;

/**
 * @author chj
 * @date 2024年10月21日
 */
@Component
public class EditableProperties {

	@Autowired
	private EditablePropertiesMapper editablePropertiesMapper;

	private static EditableProperties EditableProperties;

	// 充值奖励比率
	public static BigDecimal REFILLBONUS;
	// 提现手续比例
	public static BigDecimal SURCHARGE;
	// 透支额度
	public static BigDecimal OVERDRAFT_MAX_AMOUNT;
	// 积分有效期
	public static Long VALID_TIME;
	//消费规则，积分的抵扣倍率，和想要消费的积分数目进行乘法，抵扣金额
	public static BigDecimal RATIO_BUY;
	// 赚取规则，依赖于前端传入数目的大小进行倍率换算，可以更新成多个通道不同倍率，在后端计算出对应的积分
	public static BigDecimal RATIO_GET_CHANNEL_1;

	@PostConstruct
	public void init() {
		EditableProperties = this;
		EditableProperties.editablePropertiesMapper = this.editablePropertiesMapper;
		REFILLBONUS = editablePropertiesMapper.getREFILLBONUS();
		SURCHARGE = editablePropertiesMapper.getSURCHARGE();
		OVERDRAFT_MAX_AMOUNT = editablePropertiesMapper.getOVERDRAFT_MAX_AMOUNT();

		VALID_TIME = editablePropertiesMapper.getVALID_TIME();
		RATIO_BUY = editablePropertiesMapper.getRATIO_BUY();
		RATIO_GET_CHANNEL_1 = editablePropertiesMapper.getRATIO_GET_CHANNEL_1();
	}

}
